
package com.emsp.website.safetyStudy.action;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.emsp.website.common.base.impl.BaseActionImpl;
import com.emsp.website.safetyStudy.domain.Questions;
import com.emsp.website.safetyStudy.service.QuestionsService;

import java.io.IOException;
import java.io.InputStream;

import javax.annotation.Resource;

@Controller
@Scope("prototype")
public class SafetyStudyIndexAction extends BaseActionImpl {

	private static final long serialVersionUID = 1L;

	private Questions model = new Questions();
	
	@Resource
	private QuestionsService questionsService;
	private InputStream inputStream;
	public InputStream getInputStream() {
		return inputStream;
	}

	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	} 
	public Questions getModel() {
		return model;
	}

	public void prepare() throws Exception {
	}

	// *****************************************************************//
/**
	 * 下载题库类型：下载文字题模板
	 * @throws IOException 
	 * @throws Exception 
	 */
	public String downloadText() throws Exception{
		
		setInputStream(questionsService.exportText());
		return "downloadText" ;
	}
}